package com.baike.service.impl;

import com.baike.entity.TbStudentDiscounts;
import com.baike.mapper.TbStudentDiscountsMapper;
import com.baike.service.ITbStudentDiscountsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author libin
 * @since 2021-11-01
 */
@Service
public class TbStudentDiscountsServiceImpl extends ServiceImpl<TbStudentDiscountsMapper, TbStudentDiscounts> implements ITbStudentDiscountsService {

    @Autowired
    private TbStudentDiscountsMapper tbStudentDiscountsMapper;

    //增加一张优惠券
    @Override
    public void insertDiscounts(Integer studentId, Integer discountsId) {
        tbStudentDiscountsMapper.insertDiscounts(studentId,discountsId);
    }

    //给该用户加一张优惠券
    @Override
    public void updateStudentDiscountsCount(Integer studentId, Integer discountsId, Integer num) {
        tbStudentDiscountsMapper.updateStudentDiscountsCount(studentId,discountsId,num);
    }

    //根据条件查询  studentId discountsId  查询studentDiscounts表
    @Override
    public TbStudentDiscounts selectDiscounts(Integer studentId, Integer discountsId) {
     return  tbStudentDiscountsMapper.selectDiscounts(studentId,discountsId);
    }
}
